package test.ground.model;

import com.fasterxml.jackson.annotation.JsonValue;
import org.springframework.cache.interceptor.CacheAspectSupport;
import org.springframework.cache.interceptor.CacheOperationInvoker;

import java.lang.reflect.Method;

/**
 * @Author wangshaopeng
 * @Date 2021/1/5
 */
public enum Sex {
    man(11),woman(10);

    private int code;
    Sex(int i) {
        this.code = i;
    }

    public Integer getVOCode() {
        return code;
    }

    @JsonValue
    public String getShow() {
        switch (this){
            case man:
                return "男人";
            case woman:
                return "女人";
        }
        return null;
    }

    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class<?> operationContextsClass = Class.forName("org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContexts");
        Class<?> operationContextClass = Class.forName("org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext");

        CacheAspectSupport.class.getDeclaredMethod("findInCaches", operationContextClass, Object.class, CacheOperationInvoker.class, Method.class, operationContextsClass);
    }

}
